package main

import (
	"fmt"
	"reflect"
)

type Teacher struct {
	Id   int64
	Name string
	Age  uint8
}

func main() {
	printType()
	getTypeByReflect1()
	getTypeByReflect2()
}

func printType() {
	t := new(Teacher)
	fmt.Printf("%T\n", t) // *main.Teacher
}

func getTypeByReflect1() {
	t := new(Teacher)
	fmt.Println(reflect.TypeOf(t))      // *main.Teacher
	fmt.Println(reflect.TypeOf(t.Name)) // string
}

func getTypeByReflect2() {
	t := new(Teacher)
	fmt.Println(reflect.ValueOf(t).Kind())      // ptr
	fmt.Println(reflect.ValueOf(t.Name).Kind()) // string
}
